#!/bin/bash
# Comment功能测试运行脚本 (Linux/Mac)
# 作者: System Generated
# 日期: 2025/10/30

echo "========================================"
echo "Comment功能测试套件"
echo "========================================"
echo ""

echo "[1/4] 清理之前的构建..."
mvn clean
echo ""

echo "[2/4] 编译项目..."
mvn compile
if [ $? -ne 0 ]; then
    echo "编译失败！请检查代码错误。"
    exit 1
fi
echo ""

echo "[3/4] 运行所有Comment测试..."
mvn test -Dtest=Comment*Test
if [ $? -ne 0 ]; then
    echo "测试失败！请查看上面的错误信息。"
    exit 1
fi
echo ""

echo "[4/4] 测试完成！"
echo ""
echo "========================================"
echo "测试结果汇总"
echo "========================================"
echo "所有测试通过！"
echo ""
echo "详细报告位置:"
echo "- Surefire报告: target/surefire-reports/"
echo "- 测试输出: 见上方控制台输出"
echo ""

# 尝试打开测试报告（仅Mac）
if [[ "$OSTYPE" == "darwin"* ]] && [ -f "target/surefire-reports/index.html" ]; then
    echo "正在打开测试报告..."
    open target/surefire-reports/index.html
fi

echo ""
echo "测试完成！"



